include (FetchContent)

FetchContent_Declare(
  googletest
  GIT_REPOSITORY https://github.com/google/googletest.git
  GIT_TAG dcc920d0
)

FetchContent_GetProperties(googletest)

if (NOT googletest_POPULATED)
  FetchContent_Populate(googletest)
  add_subdirectory(
    ${googletest_SOURCE_DIR}
    ${googletest_BINARY_DIR}
    EXECLUDE_FROM_ALL
  )
endif()

message (STATUS "gtest binaries are present at ${googletest_BINARY_DIR}")
